package cn.com.ccxcredit.wallet;

import android.app.ProgressDialog;
import android.support.v7.app.AppCompatActivity;

import butterknife.Unbinder;

/**
 * Created by gongdongyang on 2018/7/4.
 */

public class BaseActivity extends AppCompatActivity {

    private ProgressDialog progressDialog;
    protected Unbinder unbinder;

    public void buildProgressDialog(int id) {
        if (progressDialog == null) {
            progressDialog = new ProgressDialog(this);
            progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        }
        progressDialog.setMessage("");
        progressDialog.setCancelable(true);
        progressDialog.show();
    }

    public void cancelProgressDialog() {
        if (progressDialog != null)
            if (progressDialog.isShowing()) {
                progressDialog.dismiss();
            }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if(unbinder!=null){
            unbinder.unbind();
        }
    }
}
